#include "linked_list.h"
#include <stdlib.h>

// Allocates memory for a node with the input element
// and a NULL next pointer, returns pointer to node
node_t* init_list(void* element)
{
    node_t* listHead = (node_t*)malloc(sizeof(node_t));
    listHead->element = element;
    listHead->next = NULL;
    return listHead;
}

// Inserts a node with the input element after the
// input node, returns ptr to new node
node_t* insert_node(node_t* priorNode, void* element)
{
    node_t* newNode = (node_t*)malloc(sizeof(node_t));
    newNode->element = element;
    newNode->next = priorNode->next;
    priorNode->next = newNode;
    return newNode;
}
